import Vue from "vue";
import VueRouter from "vue-router";
const originalPush = VueRouter.prototype.push
   VueRouter.prototype.push = function push(location) {
   return originalPush.call(this, location).catch(err => err)
}
//页面引入
import putin from '../components/dh_putin.vue'
import staff from '../components/dh_staff.vue'
import classify from '../components/dh_classify.vue'
import template from '../components/dh_template.vue'

import sdetails from '../components/dh_staffdetails.vue'
import details from '../components/dh_register_details.vue'

//路由挂载，vue的核心专用组件，实用的install方法调用，必须用Vue.use挂载
Vue.use(VueRouter);

//注册路由
const routes = [
    {
        path: '/',
        redirect: '/putin',
    },{
        path: '/putin',
        name: 'putin',
        component: putin
    },{
        path: '/staff',
        name: 'staff',
        component: staff
    },{
        path: '/classify',
        name: 'classify',
        component: classify 
    },{
        path: '/template',
        name: 'template',
        component: template
    },{
        path: '/sdetails/:aid',
        name: 'sdetails',
        component: sdetails
    },{
        path: '/details/:aid',
        name: 'details',
        component: details
    }
]

const router = new VueRouter({
    mode: 'hash',
    base: process.env.BASE_URL,
    routes
})

//注册路由暴露
export default router